#对list排序foo = [-5,8,0,4,9,-4,-20,-2,8,2,-4],使用lambda函数从小到大排序
foo = [-5,8,0,4,9,-4,-20,-2,8,2,-4]
a = sorted(foo,key=lambda x:x)
print(a)
#对list排序foo = [-5,8,0,4,9,-4,-20,-2,8,2,-4],使用lambda函数正数从小到大，负数从大到小（传两个条件，x<0和abs(x)）
foo = [-5,8,0,4,9,-4,-20,-2,8,2,-4]
a = sorted(foo,key=lambda x:(x<0,abs(x)))
print(a)
